<?php
declare (strict_types = 1);
namespace app\user\logic\user;

use app\user\model\user\UserLoginRecord as UserLoginRecordModel;

/**
 * 用户登录记录
 */
class UserLoginRecord
{
    public static function write(int $user_id)
    {
        $record          = new UserLoginRecordModel();
        $record->user_id = $user_id;
        $record->device  = request()->device_type;
        $record->ip      = request()->ip();

        return $record->save();
    }
}
